import { useInitDataSingleton } from './shared';
import { BasXueYeChanPinApi, BasXueYeChanPinAllOutput } from '/@/api/bas/BasXueYeChanPin';

const { list, initList: getBasXueYeChanPinList } = useInitDataSingleton<BasXueYeChanPinAllOutput>(BasXueYeChanPinApi.all);

// 血液来源, 不常用资料, 按需加载
export { getBasXueYeChanPinList };

// 刷新缓存
export function refreshBasXueYeChanPin() {
    list.value = [];
}

// 根据id获取
export async function getBasXueYeChanPin(id: string) {
    await getBasXueYeChanPinList();
    return list.value.find((item) => item.id == id) ?? undefined;
}